import request from '/@/utils/request';
/**
 * 企业管理
 * @param query
 * @param query.companyName 企业单位名称
 * @param query.companyType 单位性质
 
 * @returns
 */
export function companyPage(
	query?: {
		companyName: string;
		companyType: string;
	} & RequestNameSpace.LimitPageParams
) {
	return request({
		url: '/admin/companyInfo/page',
		method: 'get',
		params: query,
	});
}
/**
 * 禁用启用状态
 * @param query
 * @param query.id 企业id
 * @param query.status 企业状态
 * @returns
 */
export const upDateObj = (obj: { id: string; status: number }) => {
	return request({
		url: '/admin/companyInfo/changeStatus',
		method: 'post',
		data: obj,
	});
};

// 查询人员
/**
 
 * @param query
 * @param query.companyDeptId 名称电话号码
 * @param query.personNameTel 所属部门

 * @returns
 */
export function personPage(query?: object) {
	return request({
		url: '/admin/companyPerson/page',
		method: 'get',
		params: query,
	});
}
//新增人员
export const personAddObj = (obj: Object) => {
	return request({
		url: '/admin/companyPerson',
		method: 'post',
		data: obj,
	});
};
// 查询人员详情
export const personObj = (id: string) => {
	return request({
		url: '/admin/companyPerson/' + id,
		method: 'get',
	});
};
//编辑人员
export const personEditObj = (obj: Object) => {
	return request({
		url: '/admin/companyPerson',
		method: 'put',
		data: obj,
	});
};
// 删除人员
export const delCompanyObj = (id: string) => {
	return request({
		url: '/admin/companyPerson',
		method: 'delete',
		data: id,
	});
};
// 查询全部部门
export function deptListObj(query?: object) {
	return request({
		url: '/admin/dept/list',
		method: 'get',
		params: query,
	});
}
// 职务管理

export function dutyPage(query?: object) {
	return request({
		url: '/admin//companyDuty/page',
		method: 'get',
		params: query,
	});
}
// 删除
export const delObj = (id: Object) => {
	return request({
		url: '/admin/companyDuty',
		method: 'delete',
		data: id,
	});
};
// 新增
export const dutAddObj = (obj: Object) => {
	return request({
		url: '/admin/companyDuty',
		method: 'post',
		data: obj,
	});
};
// 编辑
export const putObj = (obj: Object) => {
	return request({
		url: '/admin/companyDuty',
		method: 'put',
		data: obj,
	});
};
// 查看所有职位 admin/companyDuty/getAllCompanyDuty
export function getAllCompany(query?: object) {
	return request({
		url: '/admin/companyDuty/getAllCompanyDuty',
		method: 'get',
		params: query,
	});
}
// 账号查询
export function accountPage(query?: object) {
	return request({
		url: '/admin/companyAccount/page',
		method: 'get',
		params: query,
	});
}
// 账号查看
export const accountObj = (id: string) => {
	return request({
		url: '/admin/companyAccount/' + id,
		method: 'get',
	});
};
// 添加账号
export const accountAddObj = (obj: Object) => {
	return request({
		url: '/admin/companyAccount',
		method: 'post',
		data: obj,
	});
};
// 企业单位获取
export function companyInfoPage(query?: object) {
	return request({
		url: '/admin/companyInfo/queryAllCompanyInfo',
		method: 'get',
		params: query,
	});
}
// 改变状态 admin/companyAccount/changeStatus
export const changeStatus = (obj: Object) => {
	return request({
		url: '/admin/companyAccount/changeStatus',
		method: 'post',
		data: obj,
	});
};
// 编辑权限 admin/companyAccount/changeUserRole
export const changeUserRole = (obj: Object) => {
	return request({
		url: '/admin/companyAccount/changeUserRole',
		method: 'post',
		data: obj,
	});
};

/**
 * 组织架构查询列表
 * @param query
 * @param query.deptName
 * @param query.deptId
 * @returns
 */
export function queryDeptPage(query: { deptName: string; deptId: string } & RequestNameSpace.LimitPageParams) {
	return request<ResponseNameSpace.CommonPageLimitData<ResponseNameSpace.Operate.DeptPageItem[]>>({
		url: '/admin/dept/queryDeptPage',
		method: 'get',
		params: query,
	});
}
// 添加部门
export const deptObj = (obj: Object) => {
	return request({
		url: '/admin/companyDept',
		method: 'post',
		data: obj,
	});
};
// 编辑部门 admin/dept
export const putDeptObj = (obj: Object) => {
	return request({
		url: '/admin/dept',
		method: 'put',
		data: obj,
	});
};
// 删除部门
export const delDeptObj = (id: string) => {
	return request({
		url: '/admin/dept/' + id,
		method: 'delete',
	});
};
// 添加部门人员
export const addPersonDept = (obj: Object) => {
	return request({
		url: '/admin/companyPerson/addPersonDept',
		method: 'post',
		data: obj,
	});
};
// 移除部门人员 admin/companyPerson/removePersonDept
export const removePersonDept = (obj: Object) => {
	return request({
		url: '/admin/companyPerson/removePersonDept',
		method: 'post',
		data: obj,
	});
};
// 查询所有人 admin/companyPerson/getAllList
export function getAllList(query?: object) {
	return request<
		{
			id: string;
			name: string;
		}[]
	>({
		url: '/admin/companyPerson/getAllList',
		method: 'get',
		params: query,
	});
}
// 重置密码
export const resetPassWord = (id: String) => {
	return request({
		url: '/admin/companyAccount/resetPassWord2/' + id,
		method: 'post',
	});
};
// 绑定公司人员
export const relationPerson = (obj: Object) => {
	return request({
		url: '/admin/companyAccount/relationPerson',
		method: 'post',
		data: obj,
	});
};
// 查询当前公司信息 admin/user/queryUserCompany
export const queryUserCompany = () => {
	return request({
		url: '/admin/user/queryUserCompany',
		method: 'post',
	});
};
// 根据公司id查询组织架构
/**
 *
 * @param query
 * @param query.deptName 部门名称
 * @param query.deptId 所属部门
 * @param query.companyId 企业id
 * @returns
 */
export function queryCompanyDeptPage(
	query?: {
		deptName: string;
		deptId: string;
		companyId: string;
	} & RequestNameSpace.LimitPageParams
) {
	return request({
		url: '/admin/dept/queryCompanyDeptPage',
		method: 'get',
		params: query,
	});
}
// 添加公司部门
export const saveCompanyDept = (obj: Object) => {
	return request({
		url: '/admin/dept/saveCompanyDept',
		method: 'post',
		data: obj,
	});
};
/**
 * 根据公司id分页查询
 * @param query
 * @param query.personNameTel 名称电话号码
 * @param query.companyDeptId 所属部门
 * @param query.companyId 企业id
 * @returns
 */
// 根据公司id分页查询
export function pageByCompanyId(
	query?: {
		personNameTel: string;
		companyDeptId: string;
		companyId: string;
	} & RequestNameSpace.LimitPageParams
) {
	return request({
		url: '/admin/companyPerson/pageByCompanyId',
		method: 'get',
		params: query,
	});
}
/**
 * 根据id查询职位
 * @param query
 * @param query.dutyName 职务名称
 * @param query.companyId 企业id
 
 * @returns
 */
//根据公司id分页查询 admin/companyDuty/pageByCompanyId
export function dutypageByCompanyId(query?: { dutyName: string; companyId: string } & RequestNameSpace.LimitPageParams) {
	return request({
		url: '/admin/companyDuty/pageByCompanyId',
		method: 'get',
		params: query,
	});
}
// 根据公司id返回角色
export function companyRoleList(id?: string) {
	return request({
		url: '/admin/role/companyRoleList/' + id,
		method: 'get',
	});
}
// 系统管理的账户管理
export function accountSysPage(query?: object) {
	return request({
		url: '/admin/companyAccount/system/page',
		method: 'get',
		params: query,
	});
}
// 获取角色2
export const listRole = () => {
	return request({
		url: '/admin/role/system/list',
		method: 'get',
	});
};

// -------------获取大屏相关数据------------
// 获取中间数据
export const getStatisticsData = () => {
	return request({
		url: '/admin/transportOperation/middle',
	});
};
// 获取运营工作台数据
export const getWorkbenchData = () => {
	return request({
		url: '/admin/transportOperation/operationWork',
	});
};
// 获取坐席服务数据
export const getSeatsStatdData = () => {
	return request({
		url: '/admin/transportOperation/seatsStat',
	});
};
// 获取告警审核数据
export const getAlarmStatData = (type: number, startTime: string, endTime: string) => {
	return request({
		url: `/admin/transportOperation/alarmStat/${type}/${startTime}/${endTime}`,
	});
};
// 获取联单审核数据
export const getKuponoStatData = (type: number, startTime: string, endTime: string) => {
	return request({
		url: `/admin/transportOperation/kuponoStat/${type}/${startTime}/${endTime}`,
	});
};
// 获取疑似点位数据
export const getSuspectedStatData = (type: number, startTime: string, endTime: string) => {
	return request({
		url: `/admin/transportOperation/suspectedStat/${type}/${startTime}/${endTime}`,
	});
};
